<template>
    <div class="mui-numbox" data-numbox-min='1' style="height:25px;">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="initcount" @change="changeCount" ref="nowcount">
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
<script>
//因为有js效果，要导入js包并初始化
import mui from "../../../lib/mui/js/mui.min.js";
export default{
    mounted(){
        mui(".mui-numbox").numbox();//初始化在mountedzhong
    },
    methods:{
        changeCount(){//因为是修改公共数据中，所以要调用mutation，这里的函数只是为了给mutation中提交参数
            this.$store.commit("updataCount",{id:this.shopId, count:this.$refs.nowcount.value });
        }
    },
    props:["initcount","shopId"],
}
</script>
<style lang="less" scoped>
</style>